

namespace MLY.Dal
{
  // The using statments must be inside namespace clause.
  // Otherwise Visual Studio 2008 delete lqKbm.designer.cs when ever it 
  // need to generate it.
  using System;

  public partial class TableWorkOrder
  {
    // TableWorkOrder fields names
    public const string cnWorkOrderId = "WorkOrderId";
    public const string cnCustomerPriority = "CustomerPriority";
    public const string cnSplitId = "SplitId";
    public const string cnTextFieldA = "TextFieldA";
    public const string cnTextFieldB = "TextFieldB";
    public const string cnTextFieldC = "TextFieldC";
    public const string cnDateFieldA = "DateFieldA";
    public const string cnDateFieldB = "DateFieldB";
    public const string cnCustomerWorkOrderNumber = "CustomerWorkOrderNumber";
    public const string cnSendDate = "SendDate";
    public const string cnRequestedDelivaryDate = "RequestedDelivaryDate";
    public const string cnContractorCatalogueCode = "ContractorCatalogueCode";
    public const string cnContractorWorkOrderNumber = "ContractorWorkOrderNumber";
    public const string cnRemarks = "Remarks";
    public const string cnOrderNumber = "OrderNumber";
    public const string cnActualDelivaryDate = "ActualDelivaryDate";
    public const string cnPlannedDelivaryDate = "PlannedDelivaryDate";
    public const string cnContractorLotNumber = "ContractorLotNumber";
    public const string cnQuantity = "Quantity";
    public const string cnCustomerCatalougeCode = "CustomerCatalougeCode";
    public const string cnProductDescription = "ProductDescription";
    public const string cnCustomerId = "CustomerId";
    public const string cnContractorId = "ContractorId";
    public const string cnUpdateDate = "UpdateDate";
    public const string cnDateCreated = "DateCreated";
    public const string cnUpdateBy = "UpdateBy";
    public const string cnTotalSum = "TotalSum";
    public const string cnOriginalWoForDist = "originalWoForDist";
    public const string cnOriginalQuantity = "originalQuantity";
    public const string cnOriginalPlannedDeliveryDate = "OriginalPlannedDeliveryDate";
    public const string cnOriginalRequestedDeliveryDate = "OriginalRequestedDeliveryDate";
    public const string cnCustomerOrderNumber = "CustomerOrderNumber";
    public const string cnDebate = "debate";
    public const string cnProject = "Project";
    public const string cnoriginalActualDeliveryDate = "OriginalActualDeliveryDate";
    public const string cndisqualifyDate = "DisqualifyDate";
    public const string cnoriginalWOForDisqualify = "originalWOForDisqualify";

    private string FieldToStr(string fieldName, object value, string comma)
    {
      if (value == null)
        return string.Format("{0} is null{1}", fieldName, comma); 
      else
        return string.Format("{0}: {1}{2}", fieldName, value, comma); 
    }

    partial void OnOriginalPlannedDeliveryDateChanged()
    {
      if (!OriginalPlannedDeliveryDate.HasValue)
        OriginalPlannedDeliveryDate = PlannedDelivaryDate;
    }

    partial void OnOriginalRequestedDeliveryDateChanged()
    {
      if (!OriginalRequestedDeliveryDate.HasValue)
        OriginalRequestedDeliveryDate = RequestedDelivaryDate;
    }

    public string ToStr()
    {
      const string comma = ", ";
      string result = FieldToStr(cnWorkOrderId, WorkOrderId, comma);
      result += FieldToStr(cnSplitId, SplitId, comma);
      result += FieldToStr(cnSplitId, SplitId, comma);
      result += FieldToStr(cnCustomerId, CustomerId, comma);
      result += FieldToStr(cnContractorId, ContractorId, comma);
      result += FieldToStr(cnCustomerWorkOrderNumber, CustomerWorkOrderNumber, comma);
      result += FieldToStr(cnContractorWorkOrderNumber, ContractorWorkOrderNumber, comma);
      result += FieldToStr(cnContractorLotNumber, ContractorLotNumber, comma);
      result += FieldToStr(cnSendDate, SendDate, comma);
      result += FieldToStr(cnRequestedDelivaryDate, RequestedDelivaryDate, comma);
      result += FieldToStr(cnPlannedDelivaryDate, PlannedDelivaryDate, comma);
      result += FieldToStr(cnActualDelivaryDate, ActualDelivaryDate, comma);
      result += FieldToStr(cnCustomerPriority, CustomerPriority, comma);
      result += FieldToStr(cnQuantity, Quantity, comma);
      result += FieldToStr(cnCustomerCatalougeCode, CustomerCatalougeCode, comma);
      result += FieldToStr(cnProductDescription, ProductDescription, comma);
      result += FieldToStr(cnTextFieldA, TextFieldA, comma);
      result += FieldToStr(cnTextFieldB, TextFieldB, comma);
      result += FieldToStr(cnTextFieldC, TextFieldC, comma);
      result += FieldToStr(cnRemarks, Remarks, comma);
      result += FieldToStr(cnOrderNumber, OrderNumber, comma);
      result += FieldToStr(cnUpdateDate, UpdateDate, comma);
      result += FieldToStr(cnDateCreated, DateCreated, comma);
      result += FieldToStr(cnUpdateBy, UpdateBy, comma);
      result += FieldToStr(cnTotalSum, TotalSum, comma);
      result += FieldToStr(cnContractorCatalogueCode, ContractorCatalogueCode, comma);
      result += FieldToStr(cnOriginalWoForDist, originalWoForDist, comma);
      result += FieldToStr(cnOriginalQuantity, originalQuantity, comma);
      result += FieldToStr(cnDateFieldA, DateFieldA, comma);
      result += FieldToStr(cnDateFieldB, DateFieldB, comma);
      result += FieldToStr(cnOriginalPlannedDeliveryDate, OriginalPlannedDeliveryDate, comma);
      result += FieldToStr(cnOriginalRequestedDeliveryDate, OriginalRequestedDeliveryDate, comma);
      result += FieldToStr(cnCustomerOrderNumber, CustomerOrderNumber, comma);
      result += FieldToStr(cnDebate, debate.ToString(), comma);
      result += FieldToStr(cnProject, Project, comma);
      result += FieldToStr(cnoriginalActualDeliveryDate, originalActualDeliveryDate, comma);
      result += FieldToStr(cndisqualifyDate, disqualifyDate, comma);
      result += FieldToStr(cnoriginalWOForDisqualify, originalWOForDisqualify, comma);
      return result;
    }

  }


}